#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

char* getHint(char* secret, char* guess);

int main()
{
	return 0;
}

char* getHint(char* secret, char* guess)
{
	short freq1[10] = { 0 }, freq2[10] = { 0 };
	int A = 0, B = 0;

	char ch1, ch2;
	for (int idx = 0; (ch1 = secret[idx]); idx++) {
		ch2 = guess[idx];
		if (ch1 == ch2) A++;
		freq1[ch1 - '0']++;
		freq2[ch2 - '0']++;
	}

	for (int i = 0; i < 10; i++)
		B += fmin(freq1[i], freq2[i]);

	double sizeA = log10(A ? A: 1),
		   sizeB = log10(B ? B: 1);
	char* res = calloc((sizeA + sizeB + 5), sizeof(char));
	sprintf(res, "%dA%dB", A, B - A);
	return res;
}
